<script setup lang="ts">
const props = defineProps(['modelValue'])
const emit = defineEmits(['update:modelValue'])

const attrs = useAttrs()
const value = ref()

const onChange = (value) => {
  emit('update:modelValue', value)
}

watch(() => props.modelValue, (newValue) => {
  value.value = newValue ? `${newValue}` : undefined
}, { immediate: true })
</script>

<template>
  <a-year-picker
    v-model="value"
    v-bind="attrs"
    placeholder="请选择"
    @change="onChange"
  />
</template>

<style scoped>

</style>
